<template>
  <!-- 标题栏-->
  <div class="nav-bar">
    <!--左边小箭头-->
    <div class="left" @click="goback"><slot name="left"><img src="~assets/image/left.png" alt="" /></slot></div>
    <!--中间标题-->
    <div class="center"><slot name="title">EWshop</slot></div>
    <!--右边-->
    <div class="right"><slot name="right"></slot></div>
  </div>
</template>

<script>
import { useRouter } from "vue-router";
export default {
  setup() {
    const router = useRouter();
    //回退功能
    const goback = () => {
      router.go(-1);
    };
    return {
      goback,
    };
  },
};
</script>

<style lang="scss" scoped>
.nav-bar {
  display: flex;
  height: 45px;
  background: var(--color-tint);
  color: #ffffff;
  position: fixed;
  line-height: 45px;
  top: 0px;
  right: 0px;
  left: 0px;
  z-index: 888;
  text-align: center;
  box-shadow: 0px 2px 0px rgba(100, 100, 100, 0.1);
}
.left,
.right {
  width: 60px;
}
.center {
  flex: 1;
}
.left img {
  width: 45px;
  padding: 8px;
}
</style>